//
//  MineInfoDescTableViewCell.m
//  MJApp
//
//  Created by scjh on 15/3/27.
//  Copyright (c) 2015年 wangliang. All rights reserved.
//

#import "MineInfoDescTableViewCell.h"

@interface MineInfoDescTableViewCell ()

@property (weak, nonatomic) IBOutlet UILabel *descLabel;
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *QQLabel;
@property (weak, nonatomic) IBOutlet UIView *lineView;

@property (weak, nonatomic) IBOutlet UILabel *userNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *ageSexLabel;
@property (weak, nonatomic) IBOutlet UILabel *addrLabel;
@property (weak, nonatomic) IBOutlet UILabel *birthLabel;
@property (weak, nonatomic) IBOutlet UILabel *emailLabel;
@property (weak, nonatomic) IBOutlet UILabel *numSeeLabel;



@end

@implementation MineInfoDescTableViewCell


+ (instancetype)initWithTableView:(UITableView *)tableView {
    
    static NSString *cellID = @"MineInfoDescTableViewCell";
    MineInfoDescTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        
        cell =  WL_XIB(@"MineInfoDescTableViewCell");
        
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    cell.cellHigh = CGRectGetHeight(cell.frame);
    return cell;
    
}


- (void)setInfoDic:(NSDictionary *)infoDic {
    
    _infoDic = infoDic;
    self.descLabel.text = infoDic[@"remark"];
    
    
    NSDictionary *attrs = @{NSFontAttributeName : self.descLabel.font};
    CGSize size = [self.descLabel.text boundingRectWithSize:CGSizeMake(IOS_IPHONE_WINDOW_WIDE - 20, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
    NSDictionary *attrs1 = @{NSFontAttributeName : self.QQLabel.font};
    CGSize size1 = [self.QQLabel.text boundingRectWithSize:CGSizeMake(IOS_IPHONE_WINDOW_WIDE, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs1 context:nil].size;
    self.cellHigh = CGRectGetMaxY(self.lineView.frame) + 12 + 8 + size1.height + 7 * 8 + size1.height * 4 + size.height;
    
    
    self.QQLabel.text = infoDic[@"qq"];
    self.userNameLabel.text = infoDic[@"nick_name"];
    NSString *sex = @"";
    if (infoDic[@"sex"] && [infoDic[@"sex"] integerValue] == 1) {
        sex = @"男";
    }
    if (infoDic[@"sex"] && [infoDic[@"sex"] integerValue] == 2) {
        sex = @"女";
    }
    self.ageSexLabel.text = [NSString stringWithFormat:@"%@,%@",infoDic[@"age"],sex];
    self.birthLabel.text = infoDic[@"birthday"];
    self.emailLabel.text = infoDic[@"email"];
    self.addrLabel.text = infoDic[@"address"];
}


- (void)awakeFromNib {
    // Initialization code
    self.numSeeLabel.hidden = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
